package it.abc.sicsic.view.backing;

import it.abc.sicsic.view.util.FacesUtil;

import it.abc.sicsic.view.util.ViewUtil;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;

import javax.faces.context.FacesContext;

import oracle.adf.view.rich.component.rich.input.RichInputText;
import oracle.adf.view.rich.component.rich.layout.RichPanelAccordion;
import oracle.adf.view.rich.component.rich.nav.RichCommandButton;

//import org.apache.log4j.Logger;

@ManagedBean(name = "backing_nauticaTemplate")
@SessionScoped

public class NauticaTemplate {
    final static String INSERISCICLIENTE = "InserisciCliente";
    final static String GESTISCICLIENTE = "GestisciCliente";
    final static String INSERISCIBARCA = "InserisciBarca";
    final static String GESTISCIBARCA = "GestisciBarca";
    final static String INSERISCISKIPPER = "InserisciSkipper";
    final static String GESTISCISKIPPER = "GestisciSkipper";
 //   private static Logger logger = Logger.getLogger(NauticaTemplate.class);
    private RichPanelAccordion accordion;

    public NauticaTemplate() {
        super();
   //     logger.info("NauticaTemplate start");        
   //     logger.info("fromPage=" + ViewUtil.getSessionFromPage());
    }
    
    public String actionInserisciCliente() {
        ViewUtil.setRequestFromPage(INSERISCICLIENTE);
        ViewUtil.setSessionFromPage(INSERISCICLIENTE);
        accordion.saveState(FacesContext.getCurrentInstance());
        return INSERISCICLIENTE;        
    }
    
    public String actionGestisciCliente() {
        ViewUtil.setRequestFromPage(GESTISCICLIENTE);
        ViewUtil.setSessionFromPage(GESTISCICLIENTE);
        accordion.saveState(FacesContext.getCurrentInstance());
        return GESTISCICLIENTE;        
    }
    
    public String actionInserisciBarca() {
        ViewUtil.setRequestFromPage(INSERISCIBARCA);
        ViewUtil.setSessionFromPage(INSERISCIBARCA);
        accordion.saveState(FacesContext.getCurrentInstance());
        return INSERISCIBARCA;        
    }
    
    public String actionGestisciBarca() {
        ViewUtil.setRequestFromPage(GESTISCIBARCA);
        ViewUtil.setSessionFromPage(GESTISCIBARCA);
        accordion.saveState(FacesContext.getCurrentInstance());
        return GESTISCIBARCA;        
    }
    
    public String actionInserisciSkipper() {
        ViewUtil.setRequestFromPage(INSERISCISKIPPER);
        ViewUtil.setSessionFromPage(INSERISCISKIPPER);
        accordion.saveState(FacesContext.getCurrentInstance());
        return INSERISCISKIPPER;        
    }
    
    public String actionGestisciSkipper() {
        ViewUtil.setRequestFromPage(GESTISCISKIPPER);
        ViewUtil.setSessionFromPage(GESTISCISKIPPER);
        accordion.saveState(FacesContext.getCurrentInstance());
        return GESTISCISKIPPER;        
    }


    public void setAccordion(RichPanelAccordion accordion) {
        this.accordion = accordion;
    }

    public RichPanelAccordion getAccordion() {
        return accordion;
    }
}
